use "C:\Users\jkbrueck\Documents\STATA\Fuel 4\US data\final_count.dta", clear

gen d1617 = 0
gen d1819 = 0
replace d1617 = 1 if retyr == 2016 | retyr == 2017
replace d1819 = 1 if retyr == 2018 | retyr == 2018

gen d2015 = 0
gen d2016 = 0
gen d2017 = 0
gen d2018 = 0
gen d2019 = 0
replace d2015 = 1 if retyr == 2015
replace d2016 = 1 if retyr == 2016 
replace d2017 = 1 if retyr == 2017
replace d2018 = 1 if retyr == 2018 
replace d2019 = 1 if retyr == 2019

gen typenum = 0
replace typenum = 737300 if type == "737-300"
replace typenum = 737400 if type == "737-400"
replace typenum = 737500 if type == "737-500"
replace typenum = 737700 if type == "737-700"
replace typenum = 737800 if type == "737-800"
replace typenum = 747400 if type == "747-400"
replace typenum = 7672001 if type == "767-200ER"
replace typenum = 767300 if type == "767-300"
replace typenum = 7673001 if type == "767-300ER"
replace typenum = 319100 if type == "A319-100"
replace typenum = 320200 if type == "A320-200"
replace typenum = 88 if type == "MD-88"
replace typenum = 82 if type == "MD-82"
replace typenum = 83 if type == "MD-83"

gen d737_300 = 0
replace d737_300 = 1 if type == "737-300"
gen d737_400 = 0
replace d737_400 = 1 if type == "737-400"
gen d737_500 = 0
replace d737_500 = 1 if type == "737-500"
gen d737_700 = 0
replace d737_700 = 1 if type == "737-700"
gen d747_400 = 0
replace d747_400 = 1 if type == "747-400"
gen d757_200 = 0
replace d757_200 = 1 if type == "757-200"
gen d767_200ER = 0
replace d767_200ER = 1 if type == "767-200ER"
gen d767_300 = 0
replace d767_300 = 1 if type == "767-300"
gen d767_300ER = 0
replace d767_300ER = 1 if type == "767-300ER"
gen dA320_200 = 0
replace dA320_200 = 1 if type == "A320-200"
gen dMD_88 = 0
replace dMD_88 = 1 if type == "MD-88"
gen dMD_82 = 0
replace dMD_82 = 1 if type == "MD-82"
gen dMD_83 = 0
replace dMD_83 = 1 if type == "MD-83"

gen eng_4 = 0
replace eng_4 = 1 if type == "747-400"

gen lcc = 0
replace lcc = 1 if airline == "WN" | airline == "B6"

gen WN = 0
replace WN = 1 if airline == "WN"
gen B6 = 0
replace B6 = 1 if airline == "B6"

*regressions without -1 constraint

logit scrap mkt_value capy age count d2015 d2016 d2017 d2018, vce(cluster type)
test mkt_value = -1
estat classification

logit scrap mkt_value age count d2015 d2016 d2017 d2018 d737_300 d737_400 d737_500 ///
d747_400 d757_200 d767_300ER dA320_200 dMD_82 dMD_83, vce(cluster type)
test mkt_value = -1
estat classification


* LOGITS IN PAPER

constraint 1 mkt_value = -1

logit scrap mkt_value capy age count d2015 d2016 d2017 d2018, constraints(1) vce(cluster type)
estat classification
predict fitvalue, xb
predict prob, pr
estat classification


constraint 1 mkt_value = -1

logit scrap mkt_value age count d2015 d2016 d2017 d2018 d737_300 d737_400 d737_500 ///
d747_400 d757_200 d767_300ER dA320_200 dMD_82 dMD_83, constraints(1) vce(cluster type)
estat classification
drop fitvalue prob
predict fitvalue, xb
predict prob, pr
estat classification


save "C:\Users\jkbrueck\Documents\STATA\Fuel 4\US data\postest1_notype.dta", replace


